package vn.gq.tym.truyennguoilonfull;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class WarningActivity extends BaseActivity implements OnClickListener {

	private Button btnOk, btnExit;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_warning);
		btnOk = (Button) findViewById(R.id.btnOk);
		btnExit = (Button) findViewById(R.id.btnExit);
		btnOk.setOnClickListener(this);
		btnExit.setOnClickListener(this);
	}
	
	public void setAgreementPref(boolean val) {
		SharedPreferences pref = getSharedPreferences(getPackageName(), MODE_PRIVATE);
		pref.edit().putBoolean("agreement", val).commit();
	}
	
	@Override
	public void onClick(View v) {
		if (v == btnOk) {
			setAgreementPref(true);
			startActivity(new Intent(this, HomeActivity.class));
			finish();
		} else {
			System.runFinalization();
			System.exit(0);
		}
	}

}
